package com.qrxl.common;

import com.qrxl.util.JGAssert;

public class JGConstant {
    /**
     * 用户session key
     */
    public static final String USER_SESSION_KEY = "userLoginInfo";
    /**
     * 短信验证码 key
     */
    public static final String VALID_CODE_KEY = "validCodeKey";
    /**
     * 管理员账号后缀
     */
    public static final String ADMIN_USER_SUFFIX = "admin";
    /**
     * 子账号账号分隔符
     */
    public static final String USER_SPLIT = "-";
    /**
     * 设备数据采集延迟key
     */
    public static final String DELAY_CMD = "delay_cmd";

    /**
     * 基准值Key
     */
    public static final String BASE_RECORD_KEY = "base_record";

    /**
     * 缓存监测点+监测类型的预警等级
     */
    private static final String WARNING_LEVEL_KEY = "warning_level";

    /**
     * AES加密key
     */
    public static final String AES_KEY = "AES_KEY20210122";

    /**
     * 小程序请求路径前缀
     */
    public static final String MINI_APP_RESIDENT_PREFIX = "/miniapp/";
    /**
     * 居民小程序登录 key
     */
    public static final String RESIDENT_MINI_APP_LOGIN_KEY = "miniAppLoginObject";
    /**
     * appid
     */
    public static final String RESIDENT_MINI_APP_ID = "wx7252f6606a3e1314";
    /**
     * 小程序登录  secret
     */
    public static final String RESIDENT_MINI_APP_SECRET = "6c406b9677b7211bbc1880d6d172673a";
    /**
     * 小程序登录请求头
     */
    public static final String HEADER_AUTHORIZATION = "sessionKey";
    /**
     * 小程序业务请求头
     */
    public static final String HEADER_TOKEN = "token";

    /**
     * SESSIONKEY过期时间
     */
    public static final Long EXPIRE = 7 * 24 * 60 * 60 * 1000L;//token有效期7天
    /**
     * token过期时间
     */
    public static final Long TOKEN_EXPIRE = 1 * 24 * 60 * 60 * 1000L;//token有效期1天

    /**
     * 系统变量缓存+name
     */
    public static final String SYS_CONFIG = "sys_config";

    public static String getWarningKey(String workPointId) {
        JGAssert.hasText(workPointId, "workPointId不能为空");
        return WARNING_LEVEL_KEY + ":" + workPointId;
    }

    public static String getWarningField(String pointId, Integer enumProjectMonitorType) {
        JGAssert.hasText(pointId, "pointId不能为空");
        JGAssert.notNull(enumProjectMonitorType, "enumProjectMonitorType不能为空");
        return pointId + ":" + enumProjectMonitorType;
    }
}
